﻿/*
 *  PassBag is multi-platform software that securely manage/store passwords
 *  Copyright (C) <2009>  <Hugo Rodrigues PEREIRA>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *	
 *  You can find a copy of the GPLv3 at project <root directory>/gpl.txt
 *
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PassBag.Presentation {
    public partial class ChangePasswordDialog : PassBag.Presentation.NewPasswordDialog {
        private string _currentPassword = string.Empty;

        public string CurrentPassword {
            set {
                _currentPassword = value;
            }
        } 

        public ChangePasswordDialog () {
            InitializeComponent ();
            LoadRessource ();
        }

        #region Load Resource

        /// <summary>
        /// Loads the ressource.
        /// </summary>
        private void LoadRessource () {
            this.Text = Properties.Resources.ChangePasswordDialog_Text;
            this.label5.Text = Properties.Resources.ChangePasswordDialog_CurrentTextTitle;
        }

        #endregion

        protected override void okBtn_Click (object sender, EventArgs e) {
            if (CurrentPasswordText.Text.Equals (_currentPassword)) {
                base.okBtn_Click (sender, e);
            }
            else {
                MessageDialog.ShowError (this,
                    Properties.Resources.ChangePasswordDialog_MsgPassNotMatch);                
            }
        }
    }
}
